from openai import OpenAI
from py_files.config import client_gemini, select_model

# 根据模型选择适当的消息格式
model_name = select_model

# 判断是 Gemma 系列还是 Gemini 系列
if model_name.startswith("gemma"):
    # Gemma 模型不支持 system 消息，直接作为用户消息发送
    messages = [
        {
            "role": "user",
            "content": "Explain to me how AI works"
        }
    ]
else:
    # Gemini 模型支持 system 消息
    messages = [
        {"role": "system", "content": "You are a helpful assistant."},
        {
            "role": "user",
            "content": "Explain to me how AI works"
        }
    ]

print(f"使用模型: {model_name}")
print(f"消息格式: {messages}")

# 创建请求
response = client_gemini.chat.completions.create(
    model=model_name,
    messages=messages
)

print(response.choices[0].message)